<!DOCTYPE html>
<html>

<head>
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta charset="utf-8" />
  <meta name="renderer" content="webkit" />
  <meta name="keywords" content="" />
  <meta name="description" content="" />
  <meta name="author" content="" />
  <title></title>
  <link href="css/daterangepicker.min.css" rel="stylesheet" />
  <link rel="stylesheet" href="css/main.css" />
  <link rel="stylesheet" href="enterpriseCommon/common.css">
  <link rel="shortcut icon" href="favicon.ico" />
  <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css" />
  <style>
    [v-cloak] {
      display: none;
    }

    .el-select input {
      height: 40px;

    }

    .section341 .search .el-select {
      width: 140px;
    }

    .section341 .search .el-input__inner {
      border: none
    }

    .section341 .left .item small {
      top: 0;
      margin-left: 0;
      left: 82px;
    }

    .section293 .info-right .face img {
      width: 100%;
    }

    .common-select {
      vertical-align: top;
      width: 100%;
    }

    .common-select .el-input__inner {
      padding-left: 15px;
    }

  </style>
  <script src="js/vue.js"></script>
  <!--[if lt IE 9]>
      <script src="js/html5shiv.min.js"></script>
      <script src="js/respond.min.js"></script>
    <![endif]-->
</head>

<body>
  <div id="app" v-cloak>
    <header></header>
    <div class="header-space"></div>

    <section class="section341">
      <div class="content">
        <div class="left">
          <a href="javascript:void(0)" class="item" @click="goBack">职位详情</a><a href="javascript:void(0)" class="item on">投递情况 <small>已投递{{summary.resume_all}}人</small></a>
        </div>
        <div class="search">
          <input v-model="keyword" type="text" placeholder="请输入关键词" class="input" @change="searchHandle(1)" />
          <div class="line"></div>
          <el-select v-model="topPosition" placeholder="请选择职位类别" @change="searchHandle(1)">
            <el-option v-for="item in positionList" :key="item.id" :label="item.name" :value="item.id">
            </el-option>
          </el-select>
          <!-- <select v-model="topPosition" name="" id="" @change="searchHandle(1)">
            <option v-for="(item, index) in positionList" :key="index" :value="item.id">{{item.name}}</option>
          </select> -->
        </div>
        <!-- <div class="search">
					<input type="text" placeholder="请输入关键词" class="input">
					<div class="line"></div>
					<select name="" id="">
						<option value="">职位类别1</option>
						<option value="">职位类别1</option>
						<option value="">职位类别2</option>
						<option value="">职位类别3</option>
					</select>
				</div> -->
      </div>
    </section>
    <section class="section292">
      <div class="content">
        <div class="filter">
          <div class="item">
            <p>期望职位</p>
            <div class="con">
              <el-select v-model="positionId" placeholder="请选择期望职位" class="common-select">
                <el-option v-for="item in positionList" :key="item.id" :label="item.name" :value="item.id">
                </el-option>
              </el-select>
            </div>
          </div>
          <div class="item">
            <p>期望工作性质</p>
            <div class="con">
              <el-select v-model="natureId" placeholder="请选择期望工作性质" class="common-select">
                <el-option v-for="item in natureList" :key="item.id" :label="item.name" :value="item.id">
                </el-option>
              </el-select>
            </div>
          </div>
          <div class="item">
            <p>求职地点</p>
            <div class="con">
              <el-select v-model="areaId" placeholder="请选择求职地点" class="common-select">
                <el-option v-for="item in areaList" :key="item.id" :label="item.region_name" :value="item.id">
                </el-option>
              </el-select>
            </div>
          </div>
          <div class="item r">
            <p>期望薪资</p>
            <input v-model="min" type="text" class="input w125" placeholder="最低" />
            <span class="ml5">--</span>
            <input v-model="max" type="text" class="input w125 r" placeholder="最高" />
          </div>
          <div class="item">
            <p>学历</p>
            <div class="con">
              <el-select v-model="educationId" placeholder="请选择学历" class="common-select">
                <el-option v-for="item in educationList" :key="item.id" :label="item.name" :value="item.id">
                </el-option>
              </el-select>
            </div>
          </div>
          <div class="item">
            <p>工作年限</p>
            <div class="con">
              <el-select v-model="expId" placeholder="请选择工作年限" class="common-select">
                <el-option v-for="item in expList" :key="item.id" :label="item.min + '-' + item.max+'年'" :value="item.id">
                </el-option>
              </el-select>
            </div>
          </div>
          <div class="item">
            <p>性别</p>
            <div class="con">
              <el-select v-model="sexId" placeholder="请选择性别" class="common-select">
                <el-option v-for="item in sexList" :key="item.id" :label="item.name" :value="item.id">
                </el-option>
              </el-select>
            </div>
          </div>
          <div class="item r">
            <p>工作状态</p>
            <div class="con">
              <el-select v-model="statusId" placeholder="请选择工作状态" class="common-select">
                <el-option v-for="item in statusList" :key="item.id" :label="item.name" :value="item.id">
                </el-option>
              </el-select>
            </div>
          </div>
          <div class="item w586">
            <p>语种能力</p>
            <div class="con">
              <el-select v-model="languageId" placeholder="请选择语种能力" class="common-select">
                <el-option v-for="item in languageList" :key="item.id" :label="item.name" :value="item.id">
                </el-option>
              </el-select>
            </div>
          </div>
          <div class="item w586 r">
            <p>毕业院校</p>
            <input v-model="school" type="text" class="input" placeholder="请输入院校名称关键字" />
          </div>
        </div>
        <div class="operate">
          <input type="submit" value="搜索" class="btn" @click="searchHandle">
          <input type="reset" value="清除" class="reset" @click="resetHandle">
        </div>
      </div>
    </section>
    <section class="section293 w1160">
      <div class="content">
        <ul class="tab-hd">
          <li v-for="(item, index) in tabList" :key="index" :class="{'on': tabIndex == index}" @click="changeTab(index)">
            {{item.txt}}（{{item.total}})
          </li>
        </ul>

        <div class="tab-bd">
          <div class="tab-con">
            <div class="list-operate">
              <label for="" :class="{on: isCheckAll}" class="checkbox" @click="changeCheckAllHandle">全选</label>
              <span class="txt">当前页面简历数量 {{currentList.length}} 份</span>
              <a href="javascript:void(0)" class="btn" @click="downLoadHandle">下载简历</a>
              <a v-show="tabIndex === 0" href="javascript:void(0)" class="btn btn-white" @click="interviewCheckHandle">发邀请</a>
            </div>
            <div class="list">
              <div v-for="(item, index) in currentList" :key="item.id" class="item">
                <label for="" :class="{on: checkMap[index]}" class="checkbox" @click="changeCheckHandle(index)"></label>
                <div class="info" @click="goResume(item.uid)">
                  <div class="info-left">
                    <div class="name"><a href="javascript:void(0)">{{item.user.name}}</a></div>
                    <ul class="con">
                      <li>{{item.user.sex|sexFilter}} | {{item.user.age}}岁 | {{item.education_experience.education}} |
                        {{item.user.area}} | {{item.resume.experience_config}}年 |
                        {{item.resume.status}}</li>
                      <li>电话：{{item.user.telephone || ''}}</li>
                      <li>邮箱：{{item.user.email}}</li>
                      <li>期望职位：{{item.resume.title}}</li>
                      <li>期望薪资：{{item.resume.salary}}</li>
                      <li>工作地点/性质：{{item.resume.area}}/{{item.resume.nature}}</li>
                      <li>毕业院校：{{item.education_experience.name}}</li>
                      <li>语种能力：{{item.language}}</li>
                      <li v-if="item.experience" class="w100">
                        工作经验：{{item.experience.position}} | {{item.experience.time}}年 | {{item.experience.name}}
                      </li>
                      <li class="w100">
                        个人标签：
                        <span v-for="(tagItem) in item.tag" :key="tagItem.tag_id" class="tag">{{tagItem.name}}</span>
                      </li>
                      <li class="w100">
                        自我评价：{{item.user.desc}}
                      </li>
                    </ul>
                  </div>
                  <div class="info-right">
                    <div class="face">
                      <a href="javascript:void(0)"><img :src="item.user.header.url || 'images/face.jpg'" alt="" /></a>
                    </div>
                    <a href="javascript:void(0)" class="btn-hart" @click="collectHandle(index)"><img :src="'images/hart'+(item.is_collect?'-on': '')+'.png'" alt="" />{{item.is_collect?'取消': ''}}收藏</a>
                  </div>
                </div>

                <!-- 待查看 -->
                <div v-if="currentTab.type == 1" class="bottom-operate">
                  <div class="left">
                    <h3>
                      <b>职位：{{ item.recruit.name }}</b><span class="money">{{item.recruit.salary_min}}~{{item.recruit.salary_max}}k</span>
                    </h3>
                    <p>投递时间：{{item.created_at}}</p>
                  </div>
                  <div class="operate">
                    <a href="javascript:void(0)" class="btn btn-white" @click="unFitHandle(index, 2)">不合适</a>
                    <a :href="'./39.html?id='+item.uid" class="btn btn-white">打招呼</a>
                    <a href="javascript:void(0)" class="btn" @click="interviewHandle(index, 0)">邀面试</a>
                  </div>
                </div>
                <!-- /待查看 -->

                <!-- 待接受 -->
                <div v-if="currentTab.type == 6" class="bottom-operate">
                  <div class="left">
                    <div class="status blue">等待对方接受面试邀请</div>
                    <ul class="con">
                      <li class="w100">邀请时间：{{ item.invite_time}}</li>
                      <li>面试职位：{{ item.recruit.name }}</li>
                      <li class="w66">面试时间：{{item.time}}</li>
                      <li>面试人： {{item.name}}</li>
                      <li class="w66">联系方式：{{item.tel}}</li>
                      <li class="w100">
                        面试地点：{{ item.interview_address }}
                      </li>
                      <li class="w100">面试备注：{{item.remark}}</li>
                    </ul>
                  </div>
                  <div class="operate">
                    <a href="javascript:void(0)" class="btn btn-white" @click="unFitHandle(index, 1)">取消面试</a>
                    <a href="javascript:void(0)" class="btn btn-white" @click="interviewHandle(index, 1)">编辑</a>
                    <a :href="'./39.html?id='+item.uid" class="btn">打招呼</a>
                  </div>
                </div>
                <!-- /待接受 -->

                <!-- 待面试 -->
                <div v-if="currentTab.type == 7" class="bottom-operate">
                  <div class="left">
                    <div class="status blue">对方已接受面试邀请</div>
                    <ul class="con">
                      <li class="w100">邀请时间：{{ item.invite_time}}</li>
                      <li>面试职位：{{ item.recruit.name }}</li>
                      <li class="w66">面试时间：{{item.time}}</li>
                      <li>面试人： {{item.name}}</li>
                      <li class="w66">联系方式：{{item.tel}}</li>
                      <li class="w100">
                        面试地点：{{ item.interview_address }}
                      </li>
                      <li class="w100">面试备注：{{item.remark}}</li>
                    </ul>
                  </div>
                  <div class="operate">
                    <a href="javascript:void(0)" class="btn btn-white" @click="overHandle(index)">面试结束</a>
                    <a href="javascript:void(0)" class="btn btn-white" @click="unFitHandle(index, 1)">取消面试</a>
                    <a href="javascript:void(0)" class="btn btn-white" @click="interviewHandle(index, 1)">编辑</a>
                    <a :href="'./39.html?id='+item.uid" class="btn">打招呼</a>
                  </div>
                </div>
                <!-- /待面试 -->
                <!-- 被拒绝 -->

                <div v-if="currentTab.type == 8" class="bottom-operate">
                  <div class="left">
                    <div class="status orange">
                      对方拒绝面试邀请 <small>拒绝原因：{{item.reason}}</small>
                    </div>

                    <ul class="con">
                      <li class="w100">拒绝时间：{{ item.invite_time}}</li>
                      <li>面试职位：{{ item.recruit.name }}</li>
                      <li class="w66">面试时间：{{item.time}}</li>
                      <li>面试人： {{item.name}}</li>
                      <li class="w66">联系方式：{{item.tel}}</li>
                      <li class="w100">
                        面试地点：{{ item.interview_address }}
                      </li>
                      <li class="w100">面试备注：{{item.remark}}</li>
                    </ul>
                  </div>
                  <div class="operate">
                    <a :href="'./39.html?id='+item.uid" class="btn">打招呼</a>
                  </div>
                </div>
                <!-- /被拒绝 -->
                <!-- 不合适 -->
                <div v-if="currentTab.type == 3" class="bottom-operate">
                  <div class="left">
                    <div class="status orange">
                      不合适
                      <small>原因描述：{{item.reason}}</small>
                    </div>

                    <ul class="con">
                      <li class="w100">操作时间：{{ item.invite_time}}</li>
                      <li>面试职位：{{ item.recruit.name }}</li>
                      <li class="w66">面试时间：{{item.time}}</li>
                      <li>面试人： {{item.name}}</li>
                      <li class="w66">联系方式：{{item.tel}}</li>
                      <li class="w100">
                        面试地点：{{ item.interview_address }}
                      </li>
                      <li class="w100">面试备注：{{item.remark}}</li>
                    </ul>
                  </div>
                  <div class="operate">
                    <a :href="'./39.html?id='+item.uid" class="btn">打招呼</a>
                  </div>
                </div>
                <!-- /不合适 -->
                <!-- 未录用 -->
                <div v-if="currentTab.type == 4" class="bottom-operate">
                  <div class="left">
                    <div v-if="item.evaluate" class="status blue">
                      企业点评： <small>{{item.evaluate}}</small>
                    </div>
                    <div v-else class="status orange">
                      <a href="javascript:void(0)" class="blue arrow" @click="evalHandle(index)">去点评</a>
                    </div>

                    <ul class=" con">
                      <li class="w100">操作时间：{{ item.invite_time}}</li>
                      <li>面试职位：{{ item.recruit.name }}</li>
                      <li class="w66">面试时间：{{item.time}}</li>
                      <li>面试人： {{item.name}}</li>
                      <li class="w66">联系方式：{{item.tel}}</li>
                      <li class="w100">
                        面试地点：{{ item.interview_address }}
                      </li>
                      <li class="w100">面试备注：{{item.remark}}</li>
                    </ul>
                  </div>
                  <div class="operate">
                    <a :href="'./39.html?id='+item.uid" class="btn">打招呼</a>
                  </div>
                </div>
                <!-- /未录用 -->
                <!-- 已录用 -->
                <div v-if="currentTab.type == 5" class="bottom-operate">
                  <div class="left">
                    <div v-if="item.evaluate" class="status blue">
                      企业点评： <small>{{item.evaluate}}</small>
                    </div>
                    <div v-else class="status orange">
                      <a href="javascript:void(0)" class="blue arrow" @click="evalHandle(index)">去点评</a>
                    </div>

                    <ul class="con">
                      <li class="w100">操作时间：{{ item.invite_time}}</li>
                      <li>面试职位：{{ item.recruit.name }}</li>
                      <li class="w66">面试时间：{{item.time}}</li>
                      <li>面试人： {{item.name}}</li>
                      <li class="w66">联系方式：{{item.tel}}</li>
                      <li class="w100">
                        面试地点：{{ item.interview_address }}
                      </li>
                      <li class="w100">面试备注：{{item.remark}}</li>
                    </ul>
                  </div>
                  <div class="operate">
                    <a :href="'./39.html?id='+item.uid" class="btn">打招呼</a>
                  </div>
                </div>
                <!-- /已录用 -->
              </div>
            </div>
          </div>
        </div>

        <div class="g-prvNxt">
          <el-pagination background layout="prev, pager, next, jumper" :total="currentTab.total" :current-page.sync="currentTab.page" :page-size="15" @current-change="getListData">
          </el-pagination>
          <!-- <a href="javascript:void(0)" class="prev">&nbsp;</a>
          <a href="javascript:void(0)">1</a>
          <a href="javascript:void(0)" class="on">2</a>
          <a href="javascript:void(0)">3</a>
          <a href="javascript:void(0)">4</a>
          <a href="javascript:void(0)">5</a>
          <a href="javascript:void(0)">6</a>
          <a href="javascript:void(0)">7</a>
          <a href="javascript:void(0)">8</a>
          <a href="javascript:void(0)">9</a>
          <a href="javascript:void(0)">10</a>
          <a href="javascript:void(0)" class="next">&nbsp;</a>
          <select name="" id="">
            <option value="">10条/页</option>
            <option value="">20条/页</option>
            <option value="">30条/页</option>
            <option value="">40条/页</option>
            <option value="">50条/页</option>
          </select>
          跳至
          <input type="text" value="5" class="input" />
          页
          <input type="submit" value="确定" class="btn" /> -->
        </div>
      </div>
    </section>

    <pop-reason v-if="isShowReason" :id="editId" :type="editType" @cancel="cancelHandle" @sure="sureHandle">
    </pop-reason>
    <pop-interview v-if="isShowIterview" ref="interview" :id="editId" :type="editType" :uid="editUid" @cancel="cancelHandle" @sure="sureHandle"></pop-interview>

    <el-dialog title="面试结束" :visible.sync="isShowDialog" width="30%">
      <span>是否录用</span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="changeInterviewResult(3)">未录用</el-button>
        <el-button type="primary" @click="changeInterviewResult(4)">已录用</el-button>
      </span>
    </el-dialog>

    <footer></footer>
  </div>

  <script src="js/jquery.min.js"></script>
  <script src="js/slide.min.js"></script>
  <script src="js/polyfill.min.js"></script>
  <script src="js/jquery.nicescroll3.7.6.min.js"></script>
  <script src="js/main.js"></script>
  <script src="https://unpkg.com/element-ui/lib/index.js"></script>
  <script src="js/request.js"></script>
  <script src="js/getPrepareData.js"></script>
  <script src="js/popComponents.js"></script>
  <script>
    $(function() {
      $("header").load("./enterpriseCommon/header.html");
      $("footer").load("./enterpriseCommon/footer.html");
    })

  </script>
  <script>
    var vm = new Vue({
      el: "#app",
      data: function() {
        var tabList = [{
            txt: "待查看",
            type: 1
          },
          {
            txt: "待接受",
            type: 6
          },
          {
            txt: "待面试",
            type: 7
          },
          {
            txt: "被拒绝",
            type: 8
          },
          {
            txt: "不合适",
            type: 3
          },
          {
            txt: "未录用",
            type: 5
          },
          {
            txt: "已录用",
            type: 4
          }
        ];
        var type = +getUrlParams().type || 1
        var tabIndex = 0;
        tabList.forEach(function(item, index) {
          item.page = 1;
          item.total = 0;
          item.listData = {};
          if (item.type === type) {
            tabIndex = index
          }
        });
        return {
          id: getUrlParams().id || '',
          tabList: tabList,
          tabIndex: tabIndex,
          keyword: '',
          keywordType: 'name',
          keywordTypeList: [{
            value: 'name',
            label: '姓名'
          }, {
            value: 'age',
            label: '年龄'
          }, {
            value: 'tag',
            label: '标签'
          }],
          topPosition: '',
          positionList: [],
          positionId: '',
          natureList: [],
          natureId: '',
          areaList: [],
          areaId: '',
          educationList: [],
          educationId: '',
          expList: [],
          expId: '',
          sexList: [{
            id: 0,
            name: '女'
          }, {
            id: 1,
            name: '男'
          }],
          sexId: '',
          statusList: [],
          statusId: '',
          languageList: [],
          languageId: '',
          school: '',
          min: '',
          max: '',
          summary: {
            resume_all: 0
          },
          checkMap: {},
          isShowReason: false,
          isShowIterview: false,
          isShowDialog: false,
          editIndex: 0, // 正在操作的简历的列表项索引
          editType: 0, // 0添加 ，取消面试, 1编辑面试
          editId: 0, // 编辑等操作时的id
          editUid: 0 // 编辑等操作是用户的id
        };
      },
      computed: {
        currentTab: function() {
          return this.tabList[this.tabIndex];
        },
        currentList: function() {
          var currentTab = this.currentTab;
          return currentTab.listData[currentTab.page] || []
        },
        editItem: function() {
          return this.currentList[this.editIndex] || {}
        },
        isCheckAll: {
          get: function() {
            var checkMap = this.checkMap;
            return Object.keys(checkMap).every(function(key) {
              return checkMap[key]
            })
          },
          set: function(bool) {
            var checkMap = this.checkMap;
            Object.keys(checkMap).forEach(function(key) {
              checkMap[key] = bool
            })
          }
        },
        checkCount: function() {
          var checkMap = this.checkMap
          return Object.keys(checkMap).reduce(function(count, key) {
            if (checkMap[key]) count++
            return count
          }, 0)
        }
      },
      created: function() {
        var self = this;
        prepare.getEnterPriseResumeData(function(data) {
          self.setPrepare(data);
          self.init();
        })
      },
      methods: {
        init(isTop) {
          this.getSummary();
          this.getListData(isTop);
        },
        goBack: function() {
          history.back()
        },
        sureHandle: function() {
          this.init();
          this.cancelHandle();
        },
        // 不合适,取消面试
        unFitHandle: function(index, type) {
          type = +type
          this.editIndex = index;
          var item = this.editItem;
          this.isShowReason = true;
          this.editType = type;
          this.editId = item.id;
          if(type === 1) {
            this.editId = item.interview_id
          }
        },
        // 邀请面试，编辑面试
        interviewHandle: function(index, type) {
          this.editIndex = index;
          var item = this.editItem;
          this.isShowIterview = true;
          this.editType = type;
          this.editUid = item.uid;
          
          this.editId = item.recruit_id;
          var userInfo = headerVm.userInfo || {}
          var params = {
            name: userInfo.name,
            tel: userInfo.telephone,
            address: item.recruit.address
          }
          if (type === 1) {
            this.editId = item.interview_id;
            params = {
              time: new Date(item.invite_time).getTime(),
              name: item.name,
              tel: item.tel,
              address: item.interview_address,
              remark: item.remark,
            }
          }
          params.recruitId = item.recruit.id
          
          function setIterviewData() {
            this.$refs.interview.setData(params)
          }
          setTimeout(setIterviewData.bind(this), 0)
        },
        // 下载简历
        downLoadHandle: function() {

          var checkCount = this.checkCount;
          var checkMap = this.checkMap;
          var currentList = this.currentList;
          if (!checkCount) return;
          var self = this;
          request('enterprise/user/resume/download', 'POST', JSON.stringify({
            id: Object.keys(checkMap).filter(function(key) {
              return checkMap[key]
            }).map(function(key) {
              var item = currentList[key]
              return item.uid;
            })
          }), function(res) {
            window.open(res.data.url)
          }, function(err) {
            sefl.$message.error(err.responseJSON ? err.responseJSON.message : '下载失败')
          })
          // this.$message('功能暂未开放')
        },
        evalHandle: function(index) {
          this.editIndex = index;
          var item = this.editItem;
          if (item.resume.id === undefined) {
            return this.$message('暂无简历')
          }

          var self = this;
          this.$prompt('请输入点评内容', '点评', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
          }).then(function(prompRes) {
            var value = prompRes.value;
            request('enterprise/resume_comment', 'POST', JSON.stringify({
              resume_id: item.resume.id,
              content: value
            }), function(res) {
              self.$message.success('点评成功')
              item.evalute = value
            })
          }).catch(function(err) {

          });
        },
        // 邀请选中
        interviewCheckHandle: function() {
          var checkCount = this.checkCount;
          var checkMap = this.checkMap;
          var currentList = this.currentList;
          if (!checkCount) {
            this.$message('请选中需要面试的人')
            return
          }
          this.editUid = Object.keys(checkMap).filter(function(key) {
            return checkMap[key]
          }).map(function(key) {
            var item = currentList[key]
            return item.uid;
          })
          this.editType = 0;
          this.isShowIterview = true;
          
          function setIterviewData() {
            var userInfo = headerVm.userInfo || {}
            var params = {
              name: userInfo.name,
              tel: userInfo.telephone
            }
            this.$refs.interview.setData(params)
          }
          setTimeout(setIterviewData.bind(this), 0)

        },
        // 面试结束
        overHandle: function(index) {
          this.editIndex = index;
          var item = this.editItem;
          this.isShowDialog = true;
          this.editId = item.id;
        },
        // 面试结束，确定面试结果
        changeInterviewResult: function(status) {
          var self = this;
          request('enterprise/user_recruit/' + this.editId, 'PUT', JSON.stringify({
            id: this.editId,
            status: statsu
          }), function(res) {
            self.$message({
              type: 'success',
              message: res.message
            });
            self.currentList.splice(self.editIndex, 1);
            self.isShowDialog = false
          }, function(err) {
            var msg = err.responseJSON ? err.responseJSON.message : '操作失败'
            self.$message({
              type: 'warning',
              message: msg
            })
            self.isShowDialog = false
          })
        },
        // 关闭弹窗
        cancelHandle: function() {
          this.isShowDialog = this.isShowIterview = this.isShowReason = false;
        },
        // 全选
        changeCheckAllHandle: function() {
          this.isCheckAll = !this.isCheckAll
        },
        // 切换单项选中
        changeCheckHandle: function(index) {
          var checkMap = this.checkMap;
          checkMap[index] = !checkMap[index];
        },
        // 搜索
        searchHandle: function(type) {
          this.currentTab.page = 1;
          this.init(type === 1);
        },
        // 重置
        resetHandle: function() {
          this.natureId = '';
          this.areaId = '';
          this.statusId = '';
          this.positionId = '';
          this.educationId = '';
          this.languageId = '';
          this.school = '';
          this.max = '';
          this.min = '';
          this.sexId = '';
          this.expId = '';
          this.currentTab.page = 1;
          this.init()
        },
        changeTab: function(index) {
          if (index === this.tabIndex) return;
          this.tabIndex = index;
          this.init();
        },
        // 设置准备（头部）信息
        setPrepare: function(data) {
          var map = {
            nature: 'natureList',
            position: 'positionList',
            education: 'educationList',
            status: 'statusList',
            language: 'languageList',
            experience: 'expList',
            region: 'areaList',
          }
          for (var key in map) {
            this[map[key]] = [{id: '', name:'不限', region_name:'不限', min: '不限', max: '不限'}].concat(data[key] || [])
          }
        },
        collectHandle: function(index) {
          this.editIndex = index;
          var item = this.editItem;
          request('enterprise/resume/collect', item.is_collect ? 'DELETE' : 'POST', JSON.stringify({
            user_id: item.uid
          }), success.bind(this))

          function success(res) {
            this.$message.success(res.message)
            this.$set(item, 'is_collect', !item.is_collect)
          }
        },
        getSummary: function() {
          var self =this
          request('recruit/summary/' + this.id, 'GET', '', function(res) {
            self.summary = res.data;
          });
          request('enterprise/index/user_recruit/summary', 'GET', {
            recruit_id: this.id
          }, function(res) {
            var tabList = self.tabList
            var typeIndexMap = tabList.reduce(function(map, item, index) {
              map[item.type] = index
              return map
            }, {})
            res.data.summary.forEach(function(item) {
              var type = item.type;
              tabList[typeIndexMap[type]].total = item.total
            })
          })
        }, // 查看简历
        goResume: function(id) {
          if (id !== undefined) {
            location.href = "./30.html?id=" + id
          } else {
            this.$message('暂无简历')
          }
        },
        // 获取简历列表
        getListData: function(type) {
          var currentTab = this.currentTab;
          var params = {
            recruit_id: this.id,
            type: currentTab.type,
            page: currentTab.page
          };
          if (type) {
            params.positon_id = this.topPosition;
            params[this.keywordType] = this.keyword;
          } else {
            params.nature_id = this.natureId;
            params.area_id = this.areaId;
            params.status_id = this.statusId;
            params.position_id = this.positionId;
            params.education_id = this.educationId;
            params.language_id = this.languageId;
            params.school = this.school;
            params.salary = this.max;
            params.sex = this.sexId;
            params.experience_config_id = this.expId;
          }
          Object.keys(params).forEach(function(key) {
            if (params[key] === '') delete params[key]
          })
          request(
            "enterprise/index/user_recruit",
            "GET", params,
            success.bind(this),
            fail.bind(this)
          );

          function success(res) {
            var data = res.data;
            var list = data.list;
            var checkMap = {};
            list.forEach(function(item, index) {
              checkMap[index] = false;
              var user = item.user;
              var resume = item.resume;
              item.education_experience.sort(function(a, b) {
                return b.id - a.id
              })
              var experience = item.experience = item.experience.slice(-1)[0];
              var e_x = item.education_experience = item.education_experience.slice[0]
              if (user) {
                user.age = new Date().getFullYear() - new Date(user.birthday).getFullYear() || 0;
                user.area = prepare.getRegionNameList(user.area_id || 1).slice(-1)[0];
              } else {
                item.user = {
                  sex: 1,
                  name: '姓名',
                  age: 0,
                  telephone: '',
                  email: '',
                  telephone: '',
                  area: ''
                }
              }

              if (resume) {
                // resume.positon = prepare.getPositionNameList(resume.position_id).slice(-1)[0];
                resume.area = prepare.getRegionNameList(resume.area_id || 1).slice(-1)[0];
                resume.status = prepare.getStatusName(resume.status_id);
                resume.nature = prepare.getNatureName(resume.nature_id);
                resume.salary = item.resume.salary_min + '-' + item.resume.salary_max + 'k';
                resume.experience_config = prepare.getExperienceName(resume.experience_config_id)
              } else {
                item.resume = {
                  position: " ",
                  area: " ",
                  status: " ",
                  nature: " ",
                  salary: " ",
                  experience_config: 0
                }
              }

              if (experience) {
                experience.time = new Date(/\d/.test(experience.end) ? experience.end : Date.now()).getFullYear() - new Date(experience.start).getFullYear();
              }
              if (e_x) {
                e_x.education = prepare.getEducationName(e_x.education_id);
              } else {
                item.education_experience = {
                  education: '',
                  name: '',
                }
              }
              item.tag.forEach(function(tagItem) {
                tagItem.name = prepare.getTagName(tagItem.tag_id);
              });
              item.language = item.language.map(function(languageItem) {
                var language = prepare.getLanguageName(languageItem.language_id);
                var ability = prepare.getAbilityName(languageItem.ability_id)
                return language ? language + '|' + ability : ''
              }).join(',');
            })
            this.checkMap = checkMap;
            this.$set(currentTab.listData, currentTab.page, list);
            currentTab.total = data.total;
          }

          function fail(err) {
            console.log(err);
          }
        }
      },
      filters: {
        sexFilter: function(sex) {
          return ['女', '男'][sex]
        }
      }
    });

  </script>
</body>

</html>
